/*
 * Word.java
 *
 * Created on June 25, 2006, 10:40 PM
 *
 */

package galronnlp.cfg.lexicon;

import java.util.List;
import java.util.LinkedList;
import galronnlp.util.Symbol;

/**
 * Implementation of a standard <code>LexicalEntry</code>
 *
 * @author Daniel A. Galron
 */
public class Word implements LexicalEntry {
    
    private int arity = 0;
    private Symbol category;
    private Symbol entry;
    
    /** Creates a new instance of Word */
    public Word(Symbol cat, Symbol entry) {
        this.category = cat;
        this.entry = entry;
    }
    
    /**
     * @return the RHS of the lexical entry (i.e. the lexical item)
     */
    public Symbol entry() {
        return this.entry;
    }
    
    /**
     * @return the LHS of the lexical entry (i.e. the category of the lexical item)
     */
    public Symbol category() {
        return this.category;
    }

    /**
     * @return the LHS of the lexical entry (i.e. the category of the lexical item)
     */    
    public Symbol LHS() {
        return this.category();
    }
    
    /**
     * @return the RHS of the lexical entry (i.e. the lexical item)
     */    
    public LinkedList<Symbol> RHS() {
        LinkedList<Symbol> list = new LinkedList<Symbol>();
        list.addLast(this.entry());
        return list;
    }
    
    public int arity() {
        return arity;
    }

    public boolean hasTerminalRHS() {
        return true;
    }

    public String toString() {
        String ret = this.category + " :- " + this.entry;
        return ret + "\n";        
    }
    
}
